<?php

namespace app\admin\controller;

use think\admin\Controller;
use think\facade\Cache;
use think\facade\Request;

class SiteConfig extends Controller
{
    /**
     * 系统参数配置
     * @auth true
     * @menu true
     */
    public function index()
    {
        Cache::delete('SystemConfig');//删除缓存
        $this->title='配置参数';
        if (request()->isPost()) {
            foreach (Request::post() as $key => $value) {
                sysconf('site.'.$key, $value);
            }
            //sysconf('site.service_agreement',input('service_agreement'));
            $this->success('操作成功');
        }
        $this->fetch('form');
    }

    public function edit()
    {
        //if (request()->isPost()) {
        //    sysconf('site.start_date',input('start_date'));
        //    sysconf('site.end_date',input('start_date'));
        //    $this->success('操作成功');
        //}
        //$this->title = '修改参数';
        //$this->fetch('form');
    }
}